package com.igeek.compus.backend.seller.service.impl;

import com.github.pagehelper.PageHelper;
import com.igeek.compus.backend.seller.dao.SellerDao;
import com.igeek.compus.backend.seller.entity.Seller;
import com.igeek.compus.backend.seller.service.SellerService;
import com.igeek.compus.backend.web.service.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SellerServiceImpl implements SellerService {

    @Autowired
    private SellerDao sellerDao;

    @Autowired
    private WebService webService;

    @Override
    public List<Seller> getSellerListByPage(Seller seller) {
        // 这里开始分页，只能写在需要分页查询语句之前
        PageHelper.startPage(seller.getPage(), seller.getLimit());
        return sellerDao.getSellerListByPage(seller);
    }

    @Override
    public List<Seller> getSellerList(Seller seller) {
        return sellerDao.getSellerList(seller);
    }

    @Override
    public int deleteSellerById(Seller seller) {
        return sellerDao.deleteSellerById(seller);
    }

    @Override
    public int deleteSellerList(List<String> sellerIdList) {
        return sellerDao.deleteSellerList(sellerIdList);
    }

    @Override
    public Seller getSellerInfoById(Integer id) {
        return sellerDao.getSellerInfoById(id);
    }

    @Override
    public int updateSeller(Seller seller) {
        return sellerDao.updateSeller(seller);
    }

}
